﻿<Window x:Class="FolderCrawlerDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:conv="clr-namespace:FolderCrawlerDemo.Converters"
        Title="{Binding FormText, FallbackValue='Folder Crawler Demo'}" 
        Width="525" Height="350"
        WindowStartupLocation="CenterScreen"
        >
    <Window.Resources>
        <conv:BooleanToWaitCursorConverter x:Key="BooleanToWaitCursorConverter" />
        <conv:ReverseBooleanConverter x:Key="ReverseBooleanConverter" />
    </Window.Resources>
    <Grid Margin="5pt" Cursor="{Binding UseWaitCursor, Converter={StaticResource BooleanToWaitCursorConverter}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="5pt" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="5pt" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="3pt" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="3pt" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Label Grid.Column="0" 
                       Content="_Folder path:"
                       Target="{Binding ElementName=FolderPathTextBox}"
                       />
                <TextBox x:Name="FolderPathTextBox"
                         Grid.Column="2"
                         Text="{Binding SelectedFolderPath, UpdateSourceTrigger=PropertyChanged}"
                         IsReadOnly="{Binding IsRunning}"
                         />
                <Button Grid.Column="4"
                        MinWidth="20pt"
                        Content="..."
                        Command="{Binding ChooseFolderCommand}"
                        />
            </Grid>
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="40*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="20*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="40*" />
                </Grid.ColumnDefinitions>
                <Button Grid.Column="1"
                        MinWidth="75pt"
                        Content="_Start"
                        Command="{Binding StartCommand}"
                        />
                <Button Grid.Column="3"
                        MinWidth="75pt"
                        Content="S_top"
                        Command="{Binding StopCommand}"
                        />
            </Grid>
        </Grid>
        <Grid Grid.Row="2">
            <TextBox x:Name="MessageTextTextBox" 
                     Text="{Binding MessageText, Mode=OneWay}"
                     IsReadOnly="True"
                     AcceptsReturn="True"
                     TextWrapping="Wrap"
                     VerticalScrollBarVisibility="Auto"
                     TextChanged="MessageTextTextBox_TextChanged"
                     Background="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
                     />
        </Grid>
    </Grid>
</Window>
